package com.example.demo.niuke;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @Author: liull
 * @Description:
 * @Date: Created in 21:50 2020/4/2
 * @Modified By:
 */
public class Main51 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = "";
        while ((line = br.readLine()) != null) {
            // 非法字符全转为空格（出大小写字母外）
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < line.length(); i++) {
                char c = line.charAt(i);
                if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
                    sb.append(c);
                } else {
                    sb.append(" ");
                }
            }
            String[] strings = sb.toString().trim().split(" ");
            List<String> strList = Arrays.asList(strings);
            for (int i = strList.size() - 1; i >= 0; i--) {
                if (i == 0) {
                    System.out.print(strList.get(i));
                } else {
                    System.out.print(strList.get(i) + " ");
                }
            }
        }
    }
}